home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 23
/
AMIGAplus Sonderheft 23 (2000)(Falke)(DE)[!].iso
/
Updates
/
HD-Installer
/
-WHDLoad-
/
WHDLoad_dev
/
Src
/
slave-examples
/
chaosengine.asm
< prev
next >
Wrap
Assembly Source File
|
1999-11-08
|
4KB
|
177 lines
;*---------------------------------------------------------------------------
; :Program. chaosengine.asm
; :Contents. Slave for ChaosEngine
; :Author. BJ
; :History. 20.05.96
; 23.05.97
; 08.08.97 new slave version, wmode killed
; 31.08.97 new keyboard style
; :Requires. -
; :Copyright. Public Domain
; :Language. 68000 Assembler
; :Translator. Barfly V1.131
; :To Do.
;---------------------------------------------------------------------------*
INCDIR Includes:
INCLUDE whdload.i
OUTPUT wart:chaosengine/chaosengine.slave
BOPT O+ OG+ ;enable optimizing
BOPT w4- ;disable 64k warnings
;======================================================================
_base SLAVE_HEADER ;ws_Security + ws_ID
dc.w 4 ;ws_Version
dc.w WHDLF_Disk|WHDLF_NoError|WHDLF_EmulTrap ;ws_flags
_upchip dc.l $ff000 ;ws_BaseMemSize
dc.l $f2800 ;ws_ExecInstall
dc.w _Start-_base ;ws_GameLoader
dc.w 0 ;ws_CurrentDir
dc.w 0 ;ws_DontCache
_keydebug dc.b $58 ;ws_keydebug = F9
_keyexit dc.b $59 ;ws_keyexit = F10
;======================================================================
_Start ; A0 = resident loader
;======================================================================
lea (_resload,pc),a1
move.l a0,(a1) ;save for later using
move.l #CACRF_EnableI,d0 ;enable instruction cache
move.l d0,d1 ;mask
jsr (resload_SetCACR,a0)
move.l #$9c00,d0 ;offset $3400 for not enough mem
move.l #$15c00,d1 ;size
moveq #1,d2 ;disk
lea $80000,a0
move.l (_resload),a3
jsr (resload_DiskLoad,a3)
clr.l $8 ;lower bound fastmem
move.l (_upchip),$14 ;uppper bound chipmem
move.l #3,$24 ;flags
clr.l $94 ;AccessFault $cccccccc pc=9ff9c
lea $80000,a4
MOVE.L $0020(A4),D0
ADD.L D0,D0
ADD.L D0,D0
LEA $002C(A4,D0.L),A1
CLR.L (A1)
MOVE.L A1,D0
LSR.L #2,D0
MOVE.L D0,$0020(A4)
move.l #$4e714e71,$24+$1d0(a4)
Jsr $0024+4(A4) ;decrunch
patch $84f5e,_loader
patch $8a3ec,_cl
jmp $24+$1ec(a4) ;start the dance
;--------------------------------
_cl add.w #$9c4,a7
move.l #$711e7e0c,$100
rts
_loader movem.l d1-d3/a0-a2,-(a7)
moveq #0,d3
cmp.w #$16,d1 ;accessing disk-id (chaos special)
bne .go
move.w (.dchk),d3
not.w d3
bne .go
lea (.disk),a1
addq.w #1,(a1)
move.w (a1),d3
cmp.w #3,d3
bne .g1
move.w #1,(a1)
.g1 moveq #0,d3
.go lea (.dchk),a1
move.w d3,(a1)
mulu #512,d1 ;start on disk
move.l d1,d0 ;offset
mulu #512,d2 ;amount of blocks
move.l d2,d1 ;size
moveq #0,d2
move.w (.disk),d2 ;disk
move.l (_resload),a2
jsr (resload_DiskLoad,a2)
movem.l (a7)+,d1-d3/a0-a2
moveq #0,d0
bsr _kinit
rts
.dchk dc.w 0
.disk dc.w 1
;--------------------------------
_kinit movem.l a0-a1,-(a7)
lea (_keyboard,pc),a1
cmp.l $68,a1
beq .q
lea (_realint68,pc),a0
move.l $68,(a0)
move.l a1,$68
.q movem.l (a7)+,a0-a1
rts
_realint68 dc.l 0
_keyboard move.l d0,-(a7)
move.b $bfec01,d0
ror.b #1,d0
not.b d0
; RAW-Key-Codes:
; ESC $45
; DEL $46
; F1..F10 $50..$59
; HELP $5f
cmp.b (_keydebug),d0
bne .1
move.l (a7)+,d0
move.w (a7),(6,a7) ;sr
move.l (2,a7),(a7) ;pc
clr.w (4,a7) ;ext.l sr
bra _debug ;coredump & quit
.1
cmp.b (_keyexit),d0
beq _exit ;exit
move.l (a7)+,d0
move.l (_realint68),-(a7) ;enter orginal rou.
rts
;--------------------------------
_resload dc.l 0 ;address of resident loader
;--------------------------------
_exit pea TDREASON_OK.w
bra _end
_debug pea TDREASON_DEBUG.w
_end move.l (_resload),-(a7)
add.l #resload_Abort,(a7)
rts
;======================================================================
END